Skip to content

feat: add Standard Compute provider - #136

Merged
veerareddyvishal144 merged 2 commits into
Fast-Editor:mainfrom
henrikdukefoss:feat/standardcompute-provider
Nov 15, 2026
Merged

veerareddyvishal144 merged 2 commits into
Fast-Editor:mainfrom
henrikdukefoss:feat/standardcompute-provider

Conversation

@henrikdukefoss

Copy link
Copy Markdown
Contributor

Adds Standard Compute as an OpenAI-compatible provider, following the same shape as the Runcrate provider (#133) and the OpenScale provider.

What it adds

  • MODEL_PROVIDER=standardcompute with STANDARDCOMPUTE_API_KEY, STANDARDCOMPUTE_MODEL and STANDARDCOMPUTE_ENDPOINT (default https://api.stdcmpt.com/v1/chat/completions)
  • Default model StandardCompute, which is routed: each request goes to the cheapest enabled model that can handle it, with automatic fallback. Pinned model ids (for example deepseek/deepseek-v4.1-flash, z-ai/glm-5.3, moonshotai/kimi-k3) come from the public GET https://api.stdcmpt.com/v1/models and work in STANDARDCOMPUTE_MODEL or TIER_*
  • invokeStandardCompute client using the existing Anthropic to Chat Completions conversion, Bearer auth, no automatic replay of billable POSTs, and a thrown 429 so tier fallback can climb
  • Registered in config validation and reload, fallback checks, routing (_enabledProviders, getBestCloudProvider), model tiers, orchestrator destination URL and tool sanitizing, OpenAI SSE transform, reasoning content, lynkr-init, and the providers API
  • Docs: .env.example, README provider table, documentation/providers.md section 8f
  • test/standardcompute-integration.test.js (mirrors the OpenScale test) added to test:unit, plus the dispatch registry list

Testing

Tests were not run locally; I am relying on CI for this PR.

Disclosure: I work on Standard Compute.

🤖 Generated with Claude Code

Adds Standard Compute as an OpenAI-compatible provider (STANDARDCOMPUTE_API_KEY,
STANDARDCOMPUTE_MODEL, STANDARDCOMPUTE_ENDPOINT), following the Runcrate and
OpenScale provider shape: config, routing, client invoker, SSE transform,
reasoning content, lynkr-init, providers API, docs and an integration test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 4 issue(s) in this PR.

  • ✅ Successfully posted inline: 4 comment(s)

providers.push({
name: "standardcompute",
type: "standardcompute",
baseUrl: config.standardcompute.endpoint || "https://api.stdcmpt.com/v1/chat/completions",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · medium
Hardcoded URL string 'https://api.stdcmpt.com/v1/chat/completions' appears in multiple files (providers-handler.js, orchestrator/index.js). If this endpoint changes, it requires updates in multiple places. Consider moving this to a configuration constant or config object to avoid duplication and ensure consistency.

Suggestion:

Suggested change
baseUrl: config.standardcompute.endpoint || "https://api.stdcmpt.com/v1/chat/completions",
const STANDARD_COMPUTE_ENDPOINT = 'https://api.stdcmpt.com/v1/chat/completions';
... // later
baseUrl: config.standardcompute.endpoint || STANDARD_COMPUTE_ENDPOINT,

Comment thread src/clients/databricks.js
convertAnthropicMessagesToOpenRouter
} = require("./openrouter-utils");

const endpoint = config.standardcompute.endpoint || "https://api.stdcmpt.com/v1/chat/completions";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · low
The endpoint default 'https://api.stdcmpt.com/v1/chat/completions' is hardcoded in two places: here and in config/index.js. This is consistent with how other providers are configured. Consider documenting this URL in the config file alongside other provider endpoints for easier discovery.

Comment thread src/clients/databricks.js
model: body._suggestionModeModel || body._tierModel || config.standardcompute.model || "StandardCompute",
messages,
temperature: body.temperature ?? 0.7,
max_tokens: body.max_tokens ?? 16384,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

performance · low
max_tokens defaults to 16384, which is consistent with other providers in the codebase (e.g., atmorouter, openscale, runcrate). However, providers may have different limits. Consider documenting the expected max_tokens range for StandardCompute in comments.

Comment thread src/clients/databricks.js
if (toolsToSend.length > 0) {
standardComputeBody.tools = convertAnthropicToolsToOpenRouter(toolsToSend);
standardComputeBody.parallel_tool_calls = false;
standardComputeBody.tool_choice = forwardToolChoice(body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · medium
The forwardToolChoice function is called but not imported at the top of the file. While it appears to be defined elsewhere in the file (line 1755) and exported, relying on a function definition that comes after this code path is a code organization anti-pattern. This could cause issues if the file is refactored. Consider either: (1) importing forwardToolChoice if it's available in a shared module, or (2) moving the definition closer to its first usage.

Suggestion:

Suggested change
standardComputeBody.tool_choice = forwardToolChoice(body);
import { forwardToolChoice } from './shared-tool-utils'; // or similar shared module

Comment thread src/clients/databricks.js
if (toolsToSend.length > 0) {
standardComputeBody.tools = convertAnthropicToolsToOpenRouter(toolsToSend);
standardComputeBody.parallel_tool_calls = false;
standardComputeBody.tool_choice = forwardToolChoice(body);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · low
The forwardToolChoice function is defined at line 55 in the same file, so it is available when called here. No action needed.

];

const REASONING_CONTENT_PROVIDERS = new Set(["moonshot", "openrouter", "edenai", "openai", "azure-openai", "atlas", "cheaperinference", "atmorouter", "runcrate", "openscale", "orcarouter"]);
const REASONING_CONTENT_PROVIDERS = new Set(["moonshot", "openrouter", "edenai", "openai", "azure-openai", "atlas", "cheaperinference", "atmorouter", "runcrate", "openscale", "standardcompute", "orcarouter"]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · medium
The addition of 'standardcompute' to REASONING_CONTENT_PROVIDERS is consistent with other providers. However, verify that StandardCompute actually supports reasoning content by checking the provider documentation. If not, remove it from this set.

Comment thread src/orchestrator/index.js
case 'openscale':
return config.openscale?.endpoint ?? 'https://api.openscale.so/v1/chat/completions';
case 'standardcompute':
return config.standardcompute?.endpoint ?? 'https://api.stdcmpt.com/v1/chat/completions';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · medium
The endpoint URL 'https://api.stdcmpt.com/v1/chat/completions' is hardcoded in this file. This duplicates the value in providers-handler.js. Consider moving this to a constants file or config object to avoid duplication and potential inconsistencies.

Suggestion:

Suggested change
return config.standardcompute?.endpoint ?? 'https://api.stdcmpt.com/v1/chat/completions';
const STANDARD_COMPUTE_ENDPOINT = 'https://api.stdcmpt.com/v1/chat/completions';
// Use STANDARD_COMPUTE_ENDPOINT instead of inline string

@henrikdukefoss

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I went through all 7 findings and didn't change code this time:

  • Endpoint URL repeated in providers-handler.js, orchestrator/index.js and databricks.js: every OpenAI-compatible provider here (runcrate, openscale, atmorouter) uses this same inline-fallback pattern, so I matched it. Happy to move all of them to shared constants in a separate PR.
  • max_tokens 16384 default: same default as the sibling providers, and callers can override it.
  • forwardToolChoice import: it's defined in the same module, so no import is needed (the follow-up comment confirms this).
  • standardcompute in REASONING_CONTENT_PROVIDERS: confirmed, the API returns reasoning_content for reasoning models.

@veerareddyvishal144
veerareddyvishal144 merged commit bf516d4 into Fast-Editor:main Nov 15, 2026
1 check passed
Comment thread bin/lynkr-init.js
{ key: 'STANDARDCOMPUTE_API_KEY', label: 'Standard Compute API key', secret: true },
],
extras: [
{ key: 'STANDARDCOMPUTE_ENDPOINT', label: 'Chat Completions endpoint', default: 'https://api.stdcmpt.com/v1/chat/completions' },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · low
The 'standardcompute' provider entry includes a hardcoded default endpoint URL ('https://api.stdcmpt.com/v1/chat/completions'). This should ideally be configurable via environment variables or configuration files to support different deployments or testing environments.

Suggestion:

Suggested change
{ key: 'STANDARDCOMPUTE_ENDPOINT', label: 'Chat Completions endpoint', default: 'https://api.stdcmpt.com/v1/chat/completions' },
{ key: 'STANDARDCOMPUTE_ENDPOINT', label: 'Chat Completions endpoint', default: process.env.STANDARDCOMPUTE_ENDPOINT || 'https://api.stdcmpt.com/v1/chat/completions' },

Comment thread src/clients/databricks.js
Comment on lines +2001 to +2009
async function invokeStandardCompute(body) {
if (!config.standardcompute?.apiKey) {
throw new Error("Standard Compute API key is not configured.");
}

const {
convertAnthropicToolsToOpenRouter,
convertAnthropicMessagesToOpenRouter
} = require("./openrouter-utils");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · medium
The conditional require('openrouter-utils') inside invokeStandardCompute may cause runtime errors if the file doesn't exist or exports change. It should be moved to the top of the file like other imports for consistency and earlier failure detection.

Suggestion:

Suggested change
async function invokeStandardCompute(body) {
if (!config.standardcompute?.apiKey) {
throw new Error("Standard Compute API key is not configured.");
}
const {
convertAnthropicToolsToOpenRouter,
convertAnthropicMessagesToOpenRouter
} = require("./openrouter-utils");
Move the require to the top of the file with other imports instead of inside the function.

Comment thread src/config/index.js
const localProviders = ["ollama", "llamacpp", "lmstudio"];
if (localProviders.includes(fallbackProvider)) {
throw new Error(`FALLBACK_PROVIDER cannot be '${fallbackProvider}' (local providers should not be fallbacks). Use cloud providers: databricks, azure-anthropic, azure-openai, openrouter, edenai, openai, atlas, cheaperinference, atmorouter, runcrate, openscale, bedrock, orcarouter`);
throw new Error(`FALLBACK_PROVIDER cannot be '${fallbackProvider}' (local providers should not be fallbacks). Use cloud providers: databricks, azure-anthropic, azure-openai, openrouter, edenai, openai, atlas, cheaperinference, atmorouter, runcrate, openscale, standardcompute, bedrock, orcarouter`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · low
The error message for FALLBACK_PROVIDER contains a long, hardcoded list of cloud providers. This list needs manual updates whenever providers are added or removed, increasing the risk of inconsistency between the error message and the actual supported providers list (SUPPORTED_MODEL_PROVIDERS). Consider deriving this list programmatically or using a centralized configuration.

Comment thread src/orchestrator/index.js
clean.tools = ensureAnthropicToolFormat(clean.tools);
}
} else if (providerType === "azure-openai" || providerType === "openai" || providerType === "atlas" || providerType === "cheaperinference" || providerType === "atmorouter" || providerType === "runcrate" || providerType === "openscale") {
} else if (providerType === "azure-openai" || providerType === "openai" || providerType === "atlas" || providerType === "cheaperinference" || providerType === "atmorouter" || providerType === "runcrate" || providerType === "openscale" || providerType === "standardcompute") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maintainability · low
Consider extracting the list of OpenAI-compatible providers into a shared constant to avoid duplication across files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants